import 'package:safetymonitor/generated/json/base/json_convert_content.dart';
import 'package:safetymonitor/app/data/entities/home/duty/get_flood_prevention_data_by_duty_entity.dart';

GetFloodPreventionDataByDutyEntity $GetFloodPreventionDataByDutyEntityFromJson(Map<String, dynamic> json) {
  final GetFloodPreventionDataByDutyEntity getFloodPreventionDataByDutyEntity = GetFloodPreventionDataByDutyEntity();
  final int? companyId = jsonConvert.convert<int>(json['companyId']);
  if (companyId != null) {
    getFloodPreventionDataByDutyEntity.companyId = companyId;
  }
  final String? companyName = jsonConvert.convert<String>(json['companyName']);
  if (companyName != null) {
    getFloodPreventionDataByDutyEntity.companyName = companyName;
  }
  final int? systemId = jsonConvert.convert<int>(json['systemId']);
  if (systemId != null) {
    getFloodPreventionDataByDutyEntity.systemId = systemId;
  }
  final String? systemName = jsonConvert.convert<String>(json['systemName']);
  if (systemName != null) {
    getFloodPreventionDataByDutyEntity.systemName = systemName;
  }
  final List<GetFloodPreventionDataByDutyFloodPreventionDataVOS>? floodPreventionDataVOS = (json['floodPreventionDataVOS'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<GetFloodPreventionDataByDutyFloodPreventionDataVOS>(e) as GetFloodPreventionDataByDutyFloodPreventionDataVOS).toList();
  if (floodPreventionDataVOS != null) {
    getFloodPreventionDataByDutyEntity.floodPreventionDataVOS = floodPreventionDataVOS;
  }
  return getFloodPreventionDataByDutyEntity;
}

Map<String, dynamic> $GetFloodPreventionDataByDutyEntityToJson(GetFloodPreventionDataByDutyEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['companyId'] = entity.companyId;
  data['companyName'] = entity.companyName;
  data['systemId'] = entity.systemId;
  data['systemName'] = entity.systemName;
  data['floodPreventionDataVOS'] = entity.floodPreventionDataVOS?.map((v) => v.toJson()).toList();
  return data;
}

extension GetFloodPreventionDataByDutyEntityExtension on GetFloodPreventionDataByDutyEntity {
  GetFloodPreventionDataByDutyEntity copyWith({
    int? companyId,
    String? companyName,
    int? systemId,
    String? systemName,
    List<GetFloodPreventionDataByDutyFloodPreventionDataVOS>? floodPreventionDataVOS,
  }) {
    return GetFloodPreventionDataByDutyEntity()
      ..companyId = companyId ?? this.companyId
      ..companyName = companyName ?? this.companyName
      ..systemId = systemId ?? this.systemId
      ..systemName = systemName ?? this.systemName
      ..floodPreventionDataVOS = floodPreventionDataVOS ?? this.floodPreventionDataVOS;
  }
}

GetFloodPreventionDataByDutyFloodPreventionDataVOS $GetFloodPreventionDataByDutyFloodPreventionDataVOSFromJson(Map<String, dynamic> json) {
  final GetFloodPreventionDataByDutyFloodPreventionDataVOS getFloodPreventionDataByDutyFloodPreventionDataVOS = GetFloodPreventionDataByDutyFloodPreventionDataVOS();
  final String? monitoringItems = jsonConvert.convert<String>(json['monitoringItems']);
  if (monitoringItems != null) {
    getFloodPreventionDataByDutyFloodPreventionDataVOS.monitoringItems = monitoringItems;
  }
  final String? monitorCode = jsonConvert.convert<String>(json['monitorCode']);
  if (monitorCode != null) {
    getFloodPreventionDataByDutyFloodPreventionDataVOS.monitorCode = monitorCode;
  }
  final String? deviceCode = jsonConvert.convert<String>(json['deviceCode']);
  if (deviceCode != null) {
    getFloodPreventionDataByDutyFloodPreventionDataVOS.deviceCode = deviceCode;
  }
  final String? deviceName = jsonConvert.convert<String>(json['deviceName']);
  if (deviceName != null) {
    getFloodPreventionDataByDutyFloodPreventionDataVOS.deviceName = deviceName;
  }
  final int? value = jsonConvert.convert<int>(json['value']);
  if (value != null) {
    getFloodPreventionDataByDutyFloodPreventionDataVOS.value = value;
  }
  final int? systemId = jsonConvert.convert<int>(json['systemId']);
  if (systemId != null) {
    getFloodPreventionDataByDutyFloodPreventionDataVOS.systemId = systemId;
  }
  final int? companyId = jsonConvert.convert<int>(json['companyId']);
  if (companyId != null) {
    getFloodPreventionDataByDutyFloodPreventionDataVOS.companyId = companyId;
  }
  return getFloodPreventionDataByDutyFloodPreventionDataVOS;
}

Map<String, dynamic> $GetFloodPreventionDataByDutyFloodPreventionDataVOSToJson(GetFloodPreventionDataByDutyFloodPreventionDataVOS entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['monitoringItems'] = entity.monitoringItems;
  data['monitorCode'] = entity.monitorCode;
  data['deviceCode'] = entity.deviceCode;
  data['deviceName'] = entity.deviceName;
  data['value'] = entity.value;
  data['systemId'] = entity.systemId;
  data['companyId'] = entity.companyId;
  return data;
}

extension GetFloodPreventionDataByDutyFloodPreventionDataVOSExtension on GetFloodPreventionDataByDutyFloodPreventionDataVOS {
  GetFloodPreventionDataByDutyFloodPreventionDataVOS copyWith({
    String? monitoringItems,
    String? monitorCode,
    String? deviceCode,
    String? deviceName,
    int? value,
    int? systemId,
    int? companyId,
  }) {
    return GetFloodPreventionDataByDutyFloodPreventionDataVOS()
      ..monitoringItems = monitoringItems ?? this.monitoringItems
      ..monitorCode = monitorCode ?? this.monitorCode
      ..deviceCode = deviceCode ?? this.deviceCode
      ..deviceName = deviceName ?? this.deviceName
      ..value = value ?? this.value
      ..systemId = systemId ?? this.systemId
      ..companyId = companyId ?? this.companyId;
  }
}